package homework.api.day06;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo2 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("hsq.jpeg");
        FileOutputStream fos = new FileOutputStream("hsq_cp2.jpeg");

        byte[] data = new byte[1024*10];
        int len;
        long start = System.currentTimeMillis();
        while((len=fis.read(data))!=-1){
            fos.write(data,0,len);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制完成！耗时："+(end-start)+"ms");
        fos.close();
        fis.close();

    }
}
